package com.kevin.constant;

public enum ReqType {

    REQ_REQUERST((byte)1),
    REQ_RESPONSE((byte)2),
    REQ_PING((byte)3),
    REQ_PONG((byte)4),
    ;


    private byte code;

    ReqType(byte code) {
        this.code = code;
    }

    public byte getCode(){
        return this.code;
    }

    public static ReqType getReqTypeByCode(byte code){
        for (ReqType reqType : ReqType.values()) {
            if(reqType.code==code) return reqType;
        }
        return null;
    }

}
